Skip to content

Commit

Permalink
Tests improving
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbalex committed Oct 14, 2019
1 parent cfcada2 commit 51e523d
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 32 deletions.
8 changes: 4 additions & 4 deletions src/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ func TestValidationErrWithNoNetwork(t *testing.T) {
var errs []ErrorInvalidValue //[]map[string]interface{}
var errOut []ErrorInvalidValue //[]map[string]interface{}

fileYML, err := os.Open("../tests/missing_maintenance_contacts.yml")
fileYML, err := os.Open("../tests/invalid.yml")
if err != nil {
log.Fatal(err)
}
out, err := ioutil.ReadFile("../tests/invalid_out.log")
out, err := ioutil.ReadFile("../tests/out_invalid.json")
if err != nil {
log.Fatal(err)
}
Expand All @@ -93,7 +93,7 @@ func TestValidationWithNoNetwork(t *testing.T) {
if err != nil {
log.Fatal(err)
}
out, err := ioutil.ReadFile("../tests/valid.minimal.out.yml")
out, err := ioutil.ReadFile("../tests/out_valid.minimal.yml")
if err != nil {
log.Fatal(err)
}
Expand All @@ -109,7 +109,7 @@ func TestValidationWithNetwork(t *testing.T) {
if err != nil {
log.Fatal(err)
}
out, err := ioutil.ReadFile("../tests/valid.minimal.out.yml")
out, err := ioutil.ReadFile("../tests/out_valid.minimal.yml")
if err != nil {
log.Fatal(err)
}
Expand Down
147 changes: 147 additions & 0 deletions tests/invalid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
publiccodeYmlVersion: "0.1"

name: Medusa
applicationSuite: MegaProductivitySuite
url: "https://github.com/italia/developers.italia.it.git" # URL of this repository
landingURL: "https://developers.italia.it"

isBasedOn: "https://github.com/italia/developers.italia.it.git" # The original repository, "Otello"
softwareVersion: "1.0" # Last stable version
releaseDate: 2017-04-15 # Date of last stable software release
logo: tests/img/logo.png
monochromeLogo: tests/img/logo-mono.svg

inputTypes:
- text/plain
outputTypes:
- text/plain

platforms: # or Windows, Mac, Linux, etc.
- android
- ios

categories:
- cloud-management

usedBy:
- Comune di Firenze
- Comune di Roma

roadmap: "https://designers.italia.it/roadmap/"

developmentStatus: development

softwareType: "standalone"

intendedAudience:
onlyFor:
- cities
- health-services
- it-ag-agricolo
countries:
- it
- de
unsupportedCountries: # Explicitly unsupported countries
- us

description:
eng:
localisedName: Medusa
genericName: "Text Editor"
shortDescription: "A really interesting software."
longDescription: >
Very long description of this software, also split
on multiple rows. You should note what the software
is and why one should need it. This is 158 characters.
Very long description of this software, also split
on multiple rows. You should note what the software
is and why one should need it. This is 316 characters.
Very long description of this software, also split
on multiple rows. You should note what the software
is and why one should need it. This is 474 characters.
Very long description of this software, also split
on multiple rows. You should note what the software
is and why one should need it. This is 632 characters.
documentation: "https://docs.developers.italia.it"
apiDocumentation: "https://developers.italia.it/it/api"

features:
- Very important feature
- Will run without a problem
- Has zero bugs
- Solves all the problems of the world
screenshots:
- tests/img/sshot1.png
- tests/img/sshot2.png
- tests/img/sshot3.png
videos: # Demo videos of the software
- https://www.youtube.com/watch?v=RaHmGbBOP84
awards:
- 1st Price Software of the year
freeTags:
- freeTag
- FreeoloTag

legal:
license: AGPL-3.0-or-later # SPDX expression of license
mainCopyrightOwner: City of Chicago
repoOwner: City of Chicago
authorsFile: tests/AUTHORS # file listing copyright information

maintenance:
type: "internal"

localisation:
# Does the software support, at least by design, multiple languages?
localisationReady: yes
# Languages already available
availableLanguages:
- eng
- ita
- fra
- deu

dependsOn: # List of dependencies. The only mandatory list is the proprietary one
open: # List of open dependencies. Optional
- name: MySQL
versionMin: "1.1"
versionMax: "1.3"
optional: yes
- name: PostgreSQL
version: "3.2"
optional: yes
# List of proprietary software which is a dependency for using this product. This includes runtime dependencies
proprietary:
- name: Oracle
versionMin: "11.4"
- name: IBM SoftLayer
hardware: # List of special hardware required. Optional.
- name: NFC Reader
optional: yes

# IT: Italian extension.
it:
conforme:
accessibile: yes
interoperabile: yes
sicuro: yes
privacy: yes

riuso:
# Codice IPA della PA che ha pubblicato questo repo (repo-owner)
codiceIPA: c_h501

spid: yes
pagopa: yes
cie: yes
anpr: yes
ecosistemi:
- scuola


designKit:
seo: no
ui: yes
web: yes
content: no
44 changes: 16 additions & 28 deletions tests/missing_maintenance_contacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ landingURL: "https://developers.italia.it"
isBasedOn: "https://github.com/italia/developers.italia.it.git" # The original repository, "Otello"
softwareVersion: "1.0" # Last stable version
releaseDate: 2017-04-15 # Date of last stable software release
logo: tests/img/logo.png
monochromeLogo: tests/img/logo-mono.svg
logo: assets/icons/logo-it.png
# monochromeLogo: assets/icons/dt-logo.svg

inputTypes:
- text/plain
Expand All @@ -34,10 +34,6 @@ developmentStatus: development
softwareType: "standalone"

intendedAudience:
onlyFor:
- cities
- health-services
- it-ag-agricolo
countries:
- it
- de
Expand Down Expand Up @@ -72,9 +68,8 @@ description:
- Has zero bugs
- Solves all the problems of the world
screenshots:
- tests/img/sshot1.png
- tests/img/sshot2.png
- tests/img/sshot3.png
- assets/images/home-logo-docs.png
- assets/images/home-logo-forum.png
videos: # Demo videos of the software
- https://www.youtube.com/watch?v=RaHmGbBOP84
awards:
Expand All @@ -87,10 +82,10 @@ legal:
license: AGPL-3.0-or-later # SPDX expression of license
mainCopyrightOwner: City of Chicago
repoOwner: City of Chicago
authorsFile: tests/AUTHORS # file listing copyright information
authorsFile: AUTHORS # file listing copyright information

maintenance:
type: "internal"
type: "community"

localisation:
# Does the software support, at least by design, multiple languages?
Expand Down Expand Up @@ -122,26 +117,19 @@ dependsOn: # List of dependencies. The only mandatory list is the pr

# IT: Italian extension.
it:
countryExtensionVersion: "0.2"
conforme:
accessibile: yes
interoperabile: yes
sicuro: yes
privacy: yes
lineeGuidaDesign: false
modelloInteroperabilita: false
misureMinimeSicurezza: false
gdpr: false

riuso:
# Codice IPA della PA che ha pubblicato questo repo (repo-owner)
codiceIPA: c_h501

spid: yes
pagopa: yes
cie: yes
anpr: yes
ecosistemi:
- scuola


designKit:
seo: no
ui: yes
web: yes
content: no
piattaforme:
spid: false
pagopa: false
cie: false
anpr: false
1 change: 1 addition & 0 deletions tests/out_invalid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"Key":"logo","Reason":"HTTP GET returned 404 for https://raw.githubusercontent.com/italia/developers.italia.it/master/tests/img/logo.png; 200 was expected"},{"Key":"monochromeLogo","Reason":"HTTP GET returned 404 for https://raw.githubusercontent.com/italia/developers.italia.it/master/tests/img/logo-mono.svg; 200 was expected"},{"Key":"description/eng/screenshots","Reason":"HTTP GET returned 404 for https://raw.githubusercontent.com/italia/developers.italia.it/master/tests/img/sshot1.png; 200 was expected"},{"Key":"legal/authorsFile","Reason":"HTTP GET returned 404 for https://raw.githubusercontent.com/italia/developers.italia.it/master/tests/AUTHORS; 200 was expected"},{"Key":"Unexpected boolean key: it/conforme/accessibile"},{"Key":"Unexpected boolean key: it/conforme/interoperabile"},{"Key":"Unexpected boolean key: it/conforme/sicuro"},{"Key":"Unexpected boolean key: it/conforme/privacy"},{"Key":"Unexpected boolean key: it/spid"},{"Key":"Unexpected boolean key: it/pagopa"},{"Key":"Unexpected boolean key: it/cie"},{"Key":"Unexpected boolean key: it/anpr"},{"Key":"Unexpected array key: it/ecosistemi"},{"Key":"Unexpected boolean key: it/designKit/content"},{"Key":"Unexpected boolean key: it/designKit/seo"},{"Key":"Unexpected boolean key: it/designKit/ui"},{"Key":"Unexpected boolean key: it/designKit/web"},{"Key":"Unexpected array key: intendedAudience/onlyFor"}]
1 change: 1 addition & 0 deletions tests/out_missing_maintenance_contacts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"Key":"maintenance/contacts","Reason":"missing but mandatory for \"internal\" or \"community\" maintenance"}]
49 changes: 49 additions & 0 deletions tests/out_valid.minimal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
publiccodeYmlVersion: "0.2"
name: Medusa
url: https://github.com/italia/developers.italia.it.git
softwareVersion: dev
releaseDate: "2017-04-15"
inputTypes:
- application/x.empty
outputTypes:
- application/x.empty
platforms:
- web
categories:
- cloud-management
developmentStatus: development
softwareType: standalone/other
intendedAudience: {}
description:
en:
localisedName: Medusa
genericName: Text Editor
shortDescription: |
A rather short description which is probably useless
longDescription: |
Very long description of this software, also split on multiple rows. You should note what the software is and why one should need it. This is 158 characters. Very long description of this software, also split on multiple rows. You should note what the software is and why one should need it. This is 316 characters. Very long description of this software, also split on multiple rows. You should note what the software is and why one should need it. This is 474 characters. Very long description of this software, also split on multiple rows. You should note what the software is and why one should need it. This is 632 characters.
features:
- Just one feature
legal:
license: AGPL-3.0-or-later
maintenance:
type: community
contacts:
- name: Francesco Rossi
localisation:
localisationReady: true
availableLanguages:
- en
it:
countryExtensionVersion: "0.2"
conforme:
lineeGuidaDesign: false
modelloInteroperabilita: false
misureMinimeSicurezza: false
gdpr: false
riuso: {}
piattaforme:
spid: false
pagopa: false
cie: false
anpr: false

0 comments on commit 51e523d

Please sign in to comment.