Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
5c6e0583
Commit
5c6e0583
authored
9 years ago
by
juanf
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-2782 : Minimum Fech Options Results Tests (Detect that fetch options return results)
SVN: 35397
parent
9d8667ea
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-map.js
+96
-94
96 additions, 94 deletions
...ts/1/as/webapps/openbis-v3-api-test/html/test/test-map.js
with
96 additions
and
94 deletions
js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-map.js
+
96
−
94
View file @
5c6e0583
...
@@ -2,7 +2,7 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
...
@@ -2,7 +2,7 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
return
function
()
{
return
function
()
{
QUnit
.
module
(
"
Map tests
"
);
QUnit
.
module
(
"
Map tests
"
);
var
testMap
=
function
(
c
,
fCreate
,
fMap
)
{
var
testMap
=
function
(
c
,
fCreate
,
fMap
,
fechOptionsTestConfig
)
{
c
.
start
();
c
.
start
();
c
.
createFacadeAndLogin
().
then
(
function
(
facade
)
{
c
.
createFacadeAndLogin
().
then
(
function
(
facade
)
{
return
fCreate
(
facade
).
then
(
function
(
permIds
)
{
return
fCreate
(
facade
).
then
(
function
(
permIds
)
{
...
@@ -11,6 +11,7 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
...
@@ -11,6 +11,7 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
c
.
assertEqual
(
Object
.
keys
(
map
).
length
,
permIds
.
length
,
"
Entity map size is correct
"
);
c
.
assertEqual
(
Object
.
keys
(
map
).
length
,
permIds
.
length
,
"
Entity map size is correct
"
);
permIds
.
forEach
(
function
(
permId
)
{
permIds
.
forEach
(
function
(
permId
)
{
var
entity
=
map
[
permId
];
var
entity
=
map
[
permId
];
testFetchOptionsResults
(
c
,
fechOptionsTestConfig
,
true
,
entity
);
c
.
assertEqual
(
entity
.
getPermId
().
toString
(),
permId
.
toString
(),
"
Entity perm id matches
"
);
c
.
assertEqual
(
entity
.
getPermId
().
toString
(),
permId
.
toString
(),
"
Entity perm id matches
"
);
});
});
c
.
finish
();
c
.
finish
();
...
@@ -52,34 +53,35 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
...
@@ -52,34 +53,35 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
}
}
}
}
var
testFetchOptionsResults
=
function
(
c
,
fo
,
toTest
,
e
ntity
,
entity
Type
)
{
var
testFetchOptionsResults
=
function
(
c
,
toTest
,
e
xpectedShouldSucceed
,
entity
)
{
for
(
property
in
toTest
)
{
for
(
property
in
toTest
)
{
var
expectedShouldSucceed
=
toTest
[
property
];
if
(
property
!==
"
SortBy
"
)
{
var
methodName
=
"
get
"
+
property
;
var
methodName
=
"
get
"
+
property
;
if
(
typeof
entity
[
methodName
]
===
"
function
"
)
{
if
(
typeof
entity
[
methodName
]
===
"
function
"
)
{
try
{
try
{
var
result
=
entity
[
methodName
]();
//Should not thrown an exception, what it means is right!
var
result
=
entity
[
methodName
]();
//Should not thrown an exception, what it means is right!
if
(
!
expectedShouldSucceed
)
{
if
(
!
expectedShouldSucceed
)
{
throw
"
Calling method
"
+
methodName
+
"
succeed when it should thrown an exception for entity type
"
+
entityType
+
"
.
"
;
throw
"
Calling method
"
+
methodName
+
"
succeed when it should thrown an exception for entity type
"
+
entity
.
toString
()
+
"
.
"
;
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
if
(
expectedShouldSucceed
)
{
if
(
expectedShouldSucceed
)
{
throw
"
Calling method
"
+
methodName
+
"
thrown an exception when it should succeed for entity type
"
+
entityType
+
"
.
"
;
throw
"
Calling method
"
+
methodName
+
"
thrown an exception when it should succeed for entity type
"
+
entity
.
toString
()
+
"
.
"
;
}
}
}
}
else
{
throw
methodName
+
"
should be a method.
"
;
}
}
}
else
{
throw
methodName
+
"
should be a method.
"
;
}
}
}
}
}
}
QUnit
.
test
(
"
mapSpaces()
"
,
function
(
assert
)
{
QUnit
.
test
(
"
mapSpaces()
"
,
function
(
assert
)
{
var
c
=
new
common
(
assert
);
var
c
=
new
common
(
assert
);
var
c
onfig
=
{
var
fechOptionsTestC
onfig
=
{
Registrator
:
true
,
Registrator
:
null
,
Projects
:
true
,
Projects
:
null
,
Samples
:
true
,
Samples
:
null
,
SortBy
:
true
SortBy
:
null
}
}
var
fCreate
=
function
(
facade
)
{
var
fCreate
=
function
(
facade
)
{
...
@@ -90,25 +92,25 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
...
@@ -90,25 +92,25 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
var
fMap
=
function
(
facade
,
permIds
)
{
var
fMap
=
function
(
facade
,
permIds
)
{
var
fo
=
new
c
.
SpaceFetchOptions
();
var
fo
=
new
c
.
SpaceFetchOptions
();
testFetchOptionsAssignation
(
c
,
fo
,
c
onfig
);
testFetchOptionsAssignation
(
c
,
fo
,
fechOptionsTestC
onfig
);
return
facade
.
mapSpaces
(
permIds
,
fo
);
return
facade
.
mapSpaces
(
permIds
,
fo
);
}
}
testMap
(
c
,
fCreate
,
fMap
);
testMap
(
c
,
fCreate
,
fMap
,
fechOptionsTestConfig
);
});
});
QUnit
.
test
(
"
mapProjects()
"
,
function
(
assert
)
{
QUnit
.
test
(
"
mapProjects()
"
,
function
(
assert
)
{
var
c
=
new
common
(
assert
);
var
c
=
new
common
(
assert
);
var
c
onfig
=
{
var
fechOptionsTestC
onfig
=
{
Experiments
:
true
,
Experiments
:
null
,
Space
:
true
,
Space
:
null
,
Leader
:
true
,
Leader
:
null
,
Modifier
:
true
,
Modifier
:
null
,
Attachments
:
true
,
Attachments
:
null
,
Registrator
:
true
,
Registrator
:
null
,
Samples
:
true
,
Samples
:
null
,
SortBy
:
true
,
SortBy
:
null
,
History
:
true
History
:
null
};
};
var
fCreate
=
function
(
facade
)
{
var
fCreate
=
function
(
facade
)
{
...
@@ -119,28 +121,28 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
...
@@ -119,28 +121,28 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
var
fMap
=
function
(
facade
,
permIds
)
{
var
fMap
=
function
(
facade
,
permIds
)
{
var
fo
=
new
c
.
ProjectFetchOptions
();
var
fo
=
new
c
.
ProjectFetchOptions
();
testFetchOptionsAssignation
(
c
,
fo
,
c
onfig
);
testFetchOptionsAssignation
(
c
,
fo
,
fechOptionsTestC
onfig
);
return
facade
.
mapProjects
(
permIds
,
fo
);
return
facade
.
mapProjects
(
permIds
,
fo
);
}
}
testMap
(
c
,
fCreate
,
fMap
);
testMap
(
c
,
fCreate
,
fMap
,
fechOptionsTestConfig
);
});
});
QUnit
.
test
(
"
mapExperiments()
"
,
function
(
assert
)
{
QUnit
.
test
(
"
mapExperiments()
"
,
function
(
assert
)
{
var
c
=
new
common
(
assert
);
var
c
=
new
common
(
assert
);
var
c
onfig
=
{
var
fechOptionsTestC
onfig
=
{
Type
:
true
,
Type
:
null
,
Project
:
true
,
Project
:
null
,
DataSets
:
true
,
DataSets
:
null
,
Properties
:
true
,
Properties
:
null
,
MaterialProperties
:
true
,
MaterialProperties
:
null
,
Tags
:
true
,
Tags
:
null
,
Samples
:
true
,
Samples
:
null
,
History
:
true
,
History
:
null
,
Registrator
:
true
,
Registrator
:
null
,
Modifier
:
true
,
Modifier
:
null
,
Attachments
:
true
,
Attachments
:
null
,
SortBy
:
true
SortBy
:
null
};
};
var
fCreate
=
function
(
facade
)
{
var
fCreate
=
function
(
facade
)
{
...
@@ -151,29 +153,29 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
...
@@ -151,29 +153,29 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
var
fMap
=
function
(
facade
,
permIds
)
{
var
fMap
=
function
(
facade
,
permIds
)
{
var
fo
=
new
c
.
ExperimentFetchOptions
();
var
fo
=
new
c
.
ExperimentFetchOptions
();
testFetchOptionsAssignation
(
c
,
fo
,
c
onfig
);
testFetchOptionsAssignation
(
c
,
fo
,
fechOptionsTestC
onfig
);
return
facade
.
mapExperiments
(
permIds
,
fo
);
return
facade
.
mapExperiments
(
permIds
,
fo
);
}
}
testMap
(
c
,
fCreate
,
fMap
);
testMap
(
c
,
fCreate
,
fMap
,
fechOptionsTestConfig
);
});
});
QUnit
.
test
(
"
mapSamples()
"
,
function
(
assert
)
{
QUnit
.
test
(
"
mapSamples()
"
,
function
(
assert
)
{
var
c
=
new
common
(
assert
);
var
c
=
new
common
(
assert
);
var
c
onfig
=
{
var
fechOptionsTestC
onfig
=
{
Parents
:
true
,
Parents
:
null
,
Children
:
true
,
Children
:
null
,
Container
:
true
,
Container
:
null
,
Components
:
true
,
Components
:
null
,
Type
:
true
,
Type
:
null
,
Project
:
true
,
Project
:
null
,
Space
:
true
,
Space
:
null
,
Experiment
:
true
,
Experiment
:
null
,
Properties
:
true
,
Properties
:
null
,
MaterialProperties
:
true
,
MaterialProperties
:
null
,
DataSets
:
true
,
DataSets
:
null
,
History
:
true
,
History
:
null
,
SortBy
:
true
SortBy
:
null
};
};
var
fCreate
=
function
(
facade
)
{
var
fCreate
=
function
(
facade
)
{
...
@@ -184,32 +186,32 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
...
@@ -184,32 +186,32 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
var
fMap
=
function
(
facade
,
permIds
)
{
var
fMap
=
function
(
facade
,
permIds
)
{
var
fo
=
new
c
.
SampleFetchOptions
();
var
fo
=
new
c
.
SampleFetchOptions
();
testFetchOptionsAssignation
(
c
,
fo
,
c
onfig
);
testFetchOptionsAssignation
(
c
,
fo
,
fechOptionsTestC
onfig
);
return
facade
.
mapSamples
(
permIds
,
fo
);
return
facade
.
mapSamples
(
permIds
,
fo
);
}
}
testMap
(
c
,
fCreate
,
fMap
);
testMap
(
c
,
fCreate
,
fMap
,
fechOptionsTestConfig
);
});
});
QUnit
.
test
(
"
mapDataSets()
"
,
function
(
assert
)
{
QUnit
.
test
(
"
mapDataSets()
"
,
function
(
assert
)
{
var
c
=
new
common
(
assert
);
var
c
=
new
common
(
assert
);
var
c
onfig
=
{
var
fechOptionsTestC
onfig
=
{
Parents
:
true
,
Parents
:
null
,
Children
:
true
,
Children
:
null
,
Components
:
true
,
Components
:
null
,
Type
:
true
,
Type
:
null
,
History
:
true
,
History
:
null
,
Experiment
:
true
,
Experiment
:
null
,
Properties
:
true
,
Properties
:
null
,
MaterialProperties
:
true
,
MaterialProperties
:
null
,
Modifier
:
true
,
Modifier
:
null
,
Registrator
:
true
,
Registrator
:
null
,
Containers
:
true
,
Containers
:
null
,
PhysicalData
:
true
,
PhysicalData
:
null
,
LinkedData
:
true
,
LinkedData
:
null
,
Tags
:
true
,
Tags
:
null
,
DataStore
:
true
,
DataStore
:
null
,
SortBy
:
true
SortBy
:
null
};
};
var
fCreate
=
function
(
facade
)
{
var
fCreate
=
function
(
facade
)
{
...
@@ -220,7 +222,7 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
...
@@ -220,7 +222,7 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
var
fMap
=
function
(
facade
,
permIds
)
{
var
fMap
=
function
(
facade
,
permIds
)
{
var
fo
=
new
c
.
DataSetFetchOptions
();
var
fo
=
new
c
.
DataSetFetchOptions
();
testFetchOptionsAssignation
(
c
,
fo
,
c
onfig
);
testFetchOptionsAssignation
(
c
,
fo
,
fechOptionsTestC
onfig
);
var
result
=
facade
.
mapDataSets
(
permIds
,
fo
);
var
result
=
facade
.
mapDataSets
(
permIds
,
fo
);
result
.
then
(
function
(
map
)
{
result
.
then
(
function
(
map
)
{
...
@@ -232,19 +234,19 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
...
@@ -232,19 +234,19 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
return
result
;
return
result
;
}
}
testMap
(
c
,
fCreate
,
fMap
);
testMap
(
c
,
fCreate
,
fMap
,
fechOptionsTestConfig
);
});
});
QUnit
.
test
(
"
mapMaterials()
"
,
function
(
assert
)
{
QUnit
.
test
(
"
mapMaterials()
"
,
function
(
assert
)
{
var
c
=
new
common
(
assert
);
var
c
=
new
common
(
assert
);
var
c
onfig
=
{
var
fechOptionsTestC
onfig
=
{
Type
:
true
,
Type
:
null
,
History
:
true
,
History
:
null
,
Registrator
:
true
,
Registrator
:
null
,
Properties
:
true
,
Properties
:
null
,
MaterialProperties
:
true
,
MaterialProperties
:
null
,
Tags
:
true
,
Tags
:
null
,
SortBy
:
true
SortBy
:
null
};
};
var
fCreate
=
function
(
facade
)
{
var
fCreate
=
function
(
facade
)
{
...
@@ -255,11 +257,11 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
...
@@ -255,11 +257,11 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
var
fMap
=
function
(
facade
,
permIds
)
{
var
fMap
=
function
(
facade
,
permIds
)
{
var
fo
=
new
c
.
MaterialFetchOptions
();
var
fo
=
new
c
.
MaterialFetchOptions
();
testFetchOptionsAssignation
(
c
,
fo
,
c
onfig
);
testFetchOptionsAssignation
(
c
,
fo
,
fechOptionsTestC
onfig
);
return
facade
.
mapMaterials
(
permIds
,
fo
);
return
facade
.
mapMaterials
(
permIds
,
fo
);
}
}
testMap
(
c
,
fCreate
,
fMap
);
testMap
(
c
,
fCreate
,
fMap
,
fechOptionsTestConfig
);
});
});
}
}
...
...
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