Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
synnefo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
itminedu
synnefo
Commits
5dcad10f
Commit
5dcad10f
authored
12 years ago
by
Giorgos Korfiatis
Browse files
Options
Downloads
Patches
Plain Diff
Import QH_PRACTICALLY_INFINITE in tests
parent
44dfc5ae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
snf-quotaholder-app/quotaholder_django/test/simpletests.py
+33
-19
33 additions, 19 deletions
snf-quotaholder-app/quotaholder_django/test/simpletests.py
with
33 additions
and
19 deletions
snf-quotaholder-app/quotaholder_django/test/simpletests.py
+
33
−
19
View file @
5dcad10f
...
...
@@ -38,6 +38,7 @@ from config import printf
from
synnefo.lib.commissioning
import
CallError
from
synnefo.lib.quotaholder.api
import
(
QH_PRACTICALLY_INFINITE
,
InvalidDataError
,
InvalidKeyError
,
NoEntityError
,
NoQuantityError
,
NoCapacityError
,
...
...
@@ -47,8 +48,6 @@ from synnefo.lib.quotaholder.api.quotaholder import (
Name
,
Key
,
Quantity
,
Capacity
,
ImportLimit
,
ExportLimit
,
Resource
,
Flags
,
Imported
,
Exported
,
Returned
,
Released
)
QH_MAX_INT
=
10
**
32
DEFAULT_HOLDING
=
(
0
,
0
,
0
,
0
)
class
QHAPITest
(
QHTestCase
):
...
...
@@ -238,30 +237,35 @@ class QHAPITest(QHTestCase):
resource1
=
self
.
rand_resource
()
r
=
self
.
qh
.
set_quota
(
set_quota
=
[(
e0
,
resource0
,
k0
)
+
(
5
,
QH_
MAX_INT
,
5
,
6
)
+
(
0
,),
set_quota
=
[(
e0
,
resource0
,
k0
)
+
(
5
,
QH_
PRACTICALLY_INFINITE
,
5
,
6
)
+
(
0
,),
(
e1
,
resource0
,
k1
)
+
(
5
,
5
,
5
,
5
)
+
(
0
,)])
self
.
assertEqual
(
r
,
[])
r
=
self
.
qh
.
add_quota
(
clientkey
=
self
.
client
,
serial
=
1
,
sub_quota
=
[(
e0
,
resource0
,
k0
,
0
,
QH_MAX_INT
,
1
,
1
)],
add_quota
=
[(
e0
,
resource0
,
k0
,
0
,
3
,
QH_MAX_INT
,
0
),
sub_quota
=
[(
e0
,
resource0
,
k0
,
0
,
QH_PRACTICALLY_INFINITE
,
1
,
1
)],
add_quota
=
[(
e0
,
resource0
,
k0
,
0
,
3
,
QH_PRACTICALLY_INFINITE
,
0
),
# new holding
(
e0
,
resource1
,
k0
,
0
,
QH_MAX_INT
,
5
,
5
)])
(
e0
,
resource1
,
k0
,
0
,
QH_PRACTICALLY_INFINITE
,
5
,
5
)])
self
.
assertEqual
(
r
,
[])
r
=
self
.
qh
.
get_quota
(
get_quota
=
[(
e0
,
resource0
,
k0
),
(
e0
,
resource1
,
k0
)])
self
.
assertEqual
(
r
,
[(
e0
,
resource0
,
5
,
3
,
QH_
MAX_INT
+
4
,
5
)
self
.
assertEqual
(
r
,
[(
e0
,
resource0
,
5
,
3
,
QH_
PRACTICALLY_INFINITE
+
4
,
5
)
+
DEFAULT_HOLDING
+
(
0
,),
(
e0
,
resource1
,
0
,
QH_
MAX_INT
,
5
,
5
)
(
e0
,
resource1
,
0
,
QH_
PRACTICALLY_INFINITE
,
5
,
5
)
+
DEFAULT_HOLDING
+
(
0
,)])
# repeated serial
r
=
self
.
qh
.
add_quota
(
clientkey
=
self
.
client
,
serial
=
1
,
sub_quota
=
[(
e0
,
resource1
,
k0
,
0
,
QH_MAX_INT
,
(
-
5
),
0
)],
add_quota
=
[(
e0
,
resource0
,
k0
,
0
,
2
,
QH_MAX_INT
,
0
)])
sub_quota
=
[(
e0
,
resource1
,
k0
,
0
,
QH_PRACTICALLY_INFINITE
,
(
-
5
),
0
)],
add_quota
=
[(
e0
,
resource0
,
k0
,
0
,
2
,
QH_PRACTICALLY_INFINITE
,
0
)])
self
.
assertEqual
(
r
,
[(
e0
,
resource1
),
(
e0
,
resource0
)])
r
=
self
.
qh
.
query_serials
(
clientkey
=
self
.
client
,
serials
=
[
1
,
2
])
...
...
@@ -284,13 +288,15 @@ class QHAPITest(QHTestCase):
# serial has been deleted
r
=
self
.
qh
.
add_quota
(
clientkey
=
self
.
client
,
serial
=
1
,
add_quota
=
[(
e0
,
resource0
,
k0
,
0
,
2
,
QH_MAX_INT
,
0
)])
add_quota
=
[(
e0
,
resource0
,
k0
,
0
,
2
,
QH_PRACTICALLY_INFINITE
,
0
)])
self
.
assertEqual
(
r
,
[])
# none is committed
r
=
self
.
qh
.
add_quota
(
clientkey
=
self
.
client
,
serial
=
2
,
add_quota
=
[(
e1
,
resource0
,
k1
,
0
,
(
-
10
),
QH_MAX_INT
,
0
),
add_quota
=
[(
e1
,
resource0
,
k1
,
0
,
(
-
10
),
QH_PRACTICALLY_INFINITE
,
0
),
(
e0
,
resource1
,
k0
,
1
,
0
,
0
,
0
)])
self
.
assertEqual
(
r
,
[(
e1
,
resource0
)])
...
...
@@ -298,7 +304,7 @@ class QHAPITest(QHTestCase):
(
e0
,
resource1
,
k0
)])
self
.
assertEqual
(
r
,
[(
e1
,
resource0
,
5
,
5
,
5
,
5
)
+
DEFAULT_HOLDING
+
(
0
,),
(
e0
,
resource1
,
0
,
QH_
MAX_INT
,
5
,
5
)
(
e0
,
resource1
,
0
,
QH_
PRACTICALLY_INFINITE
,
5
,
5
)
+
DEFAULT_HOLDING
+
(
0
,)])
def
test_0082_max_quota
(
self
):
...
...
@@ -308,17 +314,19 @@ class QHAPITest(QHTestCase):
resource1
=
self
.
rand_resource
()
r
=
self
.
qh
.
set_quota
(
set_quota
=
[(
e0
,
resource0
,
k0
)
+
(
5
,
QH_MAX_INT
,
5
,
6
)
+
(
0
,)])
set_quota
=
[(
e0
,
resource0
,
k0
)
+
(
5
,
QH_PRACTICALLY_INFINITE
,
5
,
6
)
+
(
0
,)])
self
.
assertEqual
(
r
,
[])
r
=
self
.
qh
.
add_quota
(
clientkey
=
self
.
client
,
serial
=
3
,
add_quota
=
[(
e0
,
resource0
,
k0
,
0
,
QH_MAX_INT
,
0
,
0
)])
add_quota
=
[(
e0
,
resource0
,
k0
,
0
,
QH_PRACTICALLY_INFINITE
,
0
,
0
)])
self
.
assertEqual
(
r
,
[])
r
=
self
.
qh
.
get_quota
(
get_quota
=
[(
e0
,
resource0
,
k0
)])
self
.
assertEqual
(
r
,
[(
e0
,
resource0
,
5
,
2
*
QH_
MAX_INT
,
5
,
6
)
self
.
assertEqual
(
r
,
[(
e0
,
resource0
,
5
,
2
*
QH_
PRACTICALLY_INFINITE
,
5
,
6
)
+
DEFAULT_HOLDING
+
(
0
,)])
...
...
@@ -422,9 +430,15 @@ class QHAPITest(QHTestCase):
if
r
:
raise
AssertionError
(
"
cannot create entities
"
)
self
.
qh
.
set_quota
(
set_quota
=
[(
sys
,
resource
,
''
,
10
,
0
,
QH_MAX_INT
,
QH_MAX_INT
,
0
),
(
e0
,
resource
,
k0
,
0
,
10
,
QH_MAX_INT
,
QH_MAX_INT
,
0
),
(
e1
,
resource
,
k1
,
0
,
10
,
QH_MAX_INT
,
QH_MAX_INT
,
0
)])
self
.
qh
.
set_quota
(
set_quota
=
[(
sys
,
resource
,
''
,
10
,
0
,
QH_PRACTICALLY_INFINITE
,
QH_PRACTICALLY_INFINITE
,
0
),
(
e0
,
resource
,
k0
,
0
,
10
,
QH_PRACTICALLY_INFINITE
,
QH_PRACTICALLY_INFINITE
,
0
),
(
e1
,
resource
,
k1
,
0
,
10
,
QH_PRACTICALLY_INFINITE
,
QH_PRACTICALLY_INFINITE
,
0
)])
s0
=
self
.
qh
.
issue_commission
(
clientkey
=
self
.
client
,
target
=
e0
,
key
=
k0
,
name
=
'
a commission
'
,
...
...
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