-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reject if namespace contains string mismatched with env #232
Conversation
@charlienegri - can you add the suggested tests? |
so to clarify: I added the file tests/files/api/staging.xml to test the mismatch between env and namespace in |
As mentioned in #232 - we must test that when the env is dev, we accept both |
I have now split the test in dev/staging, added another file to the tests batch, to test a .dev namespace |
No, not really. It should be explicit. |
in testApiWorker_NamespaceReplacement we test that a namespace |
@@ -104,48 +100,60 @@ def validate(self, data): | |||
if not valid: | |||
return valid, msg, data | |||
|
|||
if (".dev" in self._namespace and self._conf.env_string != "dev") or ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just check
if (".dev" in self._namespace and self._conf.env_string != "dev") or ( | |
if (self._conf.env_string not in self._namespace) or ( |
and so on? Does it fail for prod then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this?
if (".dev" in self._namespace and self._conf.env_string != "dev") or ( | |
if self._conf.env_string != "" and self._conf.env_string not in self._namespace: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that this will also be wrong. The point is that I prefer to avoid hardcoding "dev" and "staging"...
…og-ingestor into issue_228
Summary: if the namespace already contains a string mismatched with the env string, file should be rejected
Related issue:
#228
Suggested reviewer(s):
Reviewer checklist:
The checklist is based on the S-ENDA conventions and definition of done (see General Conventions). The above points are not necessarily relevant to all contributions. In that case, please add a short explanation to help the reviewer.