Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
atdb-ldv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
ASTRON SDC
atdb-ldv
Merge requests
!335
handling review comments
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Merged
handling review comments
SDC-1187-add-archived-page
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Nico Vermaas
requested to merge
SDC-1187-add-archived-page
into
master
1 year ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
7d1c7b70
1 commit,
1 year ago
1 file
+
9
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
atdb/taskdatabase/tests/test_path_to_lta.py
+
9
−
5
Options
from
django.test
import
TestCase
from
taskdatabase.models
import
Task
,
Workflow
from
taskdatabase.models
import
Task
class
TaskModelTestCase
(
TestCase
):
def
setUp
(
self
):
@@ -10,22 +10,26 @@ class TaskModelTestCase(TestCase):
self
.
task2
=
Task
.
objects
.
create
(
sas_id
=
12345
,
archive
=
{
'
path_to_lta
'
:
None
})
# this task has a valid path_to_lta set
self
.
task3
=
Task
.
objects
.
create
(
sas_id
=
12345
,
archive
=
{
'
path_to_lta
'
:
'
/sample/path
'
})
self
.
task3
=
Task
.
objects
.
create
(
sas_id
=
12345
,
archive
=
{
'
path_to_lta
'
:
'
/sample/path
'
,
'
sas_id_archived
'
:
54321
})
# this sasid has no path_to_lta set at all
self
.
task4
=
Task
.
objects
.
create
(
sas_id
=
66666
,
archive
=
{})
self
.
task5
=
Task
.
objects
.
create
(
sas_id
=
66666
,
archive
=
{})
def
test_path_to_lta_with_path
(
self
):
# if only one of the tasks has a path_to_lta, then the other tasks should also return that path
for
task
in
Task
.
objects
.
filter
(
sas_id
=
12345
):
result
=
task
.
sasid_path_to_lta
self
.
assertEqual
(
result
,
'
/sample/path
'
)
def
test_path_to_lta_without_path
(
self
):
# if one of the tasks has 'path_to_lta' set, then return None
for
task
in
Task
.
objects
.
filter
(
sas_id
=
66666
):
result
=
task
.
sasid_path_to_lta
self
.
assertEqual
(
result
,
None
)
\ No newline at end of file
self
.
assertEqual
(
result
,
None
)
def
test_sas_id_has_archived
(
self
):
# if only one of the tasks has a sas_id_has_archived, then the other tasks should also return that path
for
task
in
Task
.
objects
.
filter
(
sas_id
=
12345
):
result
=
task
.
sas_id_has_archived
self
.
assertEqual
(
result
,
54321
)
\ No newline at end of file
Loading