Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sage Validation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
Sage Validation
Commits
9eab6a56
Commit
9eab6a56
authored
2 weeks ago
by
Neda Moeini
Browse files
Options
Downloads
Patches
Plain Diff
Change the NC_CC_DEP validation error handling
parent
aa050571
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!8
Change the NC_CC_DEP validation error handling
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sage_validation/file_validator/forms.py
+4
-2
4 additions, 2 deletions
sage_validation/file_validator/forms.py
test/test_file_validator/test_forms.py
+3
-1
3 additions, 1 deletion
test/test_file_validator/test_forms.py
with
7 additions
and
3 deletions
sage_validation/file_validator/forms.py
+
4
−
2
View file @
9eab6a56
...
...
@@ -244,9 +244,11 @@ class CSVUploadForm(forms.Form):
dep
=
row
.
get
(
dep_field
)
nominal_account_name
=
row
.
get
(
nominal_account_field
)
if
not
cc
and
not
dep
and
not
nominal_account_name
:
errors
.
append
(
f
"
Row
{
index
}
: Missing values in
'
{
cc_field
}
'
,
'
{
dep_field
}
'
, and
'
{
nominal_account_field
}
'
.
"
)
continue
if
not
cc
or
not
dep
or
not
nominal_account_name
:
errors
.
append
(
f
"
Row
{
index
}
: Missing values in
'
{
cc_field
}
'
,
'
{
dep_field
}
'
, or
"
f
"'
{
nominal_account_field
}
'
.
"
)
continue
cc_type
=
cost_centre_map
.
get
(
cc
)
...
...
This diff is collapsed.
Click to expand it.
test/test_file_validator/test_forms.py
+
3
−
1
View file @
9eab6a56
...
...
@@ -101,13 +101,15 @@ def test_validate_nc_cc_dep_combination_against_meo_sage_account_blank_values(
sample_input_file
,
{
"
NominalAnalysisNominalCostCentre/1
"
:
""
,
"
NominalAnalysisNominalDepartment/1
"
:
""
,
"
NominalAnalysisNominalAccountNumber/1
"
:
""
})
form
=
CSVUploadForm
(
files
=
{
"
file
"
:
modified_file
})
assert
not
form
.
is_valid
()
assert
(
"
Row 1: Missing values in
'
NominalAnalysisNominalCostCentre/1
'
,
'
NominalAnalysisNominalDepartment/1
'
,
"
"
or
'
NominalAnalysisNominalAccountNumber/1
'
.
"
"
and
'
NominalAnalysisNominalAccountNumber/1
'
.
"
in
str
(
form
.
errors
[
"
file
"
][
0
])
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment