Skip to content

Commit 725b036

Browse files
committed
Fixed Fixtures
1 parent aa476c6 commit 725b036

14 files changed

Lines changed: 132 additions & 134 deletions

File tree

.meteor/packages

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
## METEOR CORE
88
meteor-base@1.1.0 # Packages every Meteor app needs to have
9-
mongo@1.2.0 # The database Meteor supports right now
9+
mongo@1.2.2 # The database Meteor supports right now
1010
reactive-var@1.0.11 # Reactive variable for tracker
1111
tracker@1.1.3 # Meteor's client-side reactive programming library
1212

1313
## PRODUCTION ENHANCEMENTS
14-
standard-minifier-css@1.3.4 # CSS minifier run for production mode
14+
standard-minifier-css@1.3.5 # CSS minifier run for production mode
1515
abernix:standard-minifier-js@1.3.2 # JS minifier
1616
es5-shim@4.6.15 # ECMAScript 5 compatibility for older browsers.
1717

@@ -24,9 +24,9 @@ aldeed:schema-index
2424

2525
## TESTING
2626
meteortesting:mocha
27-
dynamic-import@0.1.1
27+
dynamic-import@0.1.3
2828

2929
## ACCOUNTS
30-
accounts-password@1.4.0
30+
accounts-password
3131
accounts-google@1.2.0
3232
service-configuration@1.0.11

.meteor/release

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
METEOR@1.5.2
1+
METEOR@1.5.2.1

.meteor/versions

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
abernix:minifier-js@1.3.19
22
abernix:standard-minifier-js@1.3.19
3-
accounts-base@1.3.2
3+
accounts-base@1.3.4
44
accounts-google@1.2.0
55
accounts-oauth@1.1.15
66
accounts-password@1.4.0
@@ -23,14 +23,14 @@ boilerplate-generator@1.2.0
2323
caching-compiler@1.1.9
2424
callback-hook@1.0.10
2525
check@1.2.5
26-
ddp@1.3.0
27-
ddp-client@2.1.1
26+
ddp@1.3.1
27+
ddp-client@2.1.3
2828
ddp-common@1.2.9
2929
ddp-rate-limiter@1.0.7
30-
ddp-server@2.0.0
30+
ddp-server@2.0.2
3131
diff-sequence@1.0.7
32-
dynamic-import@0.1.1
33-
ecmascript@0.8.2
32+
dynamic-import@0.1.3
33+
ecmascript@0.8.3
3434
ecmascript-runtime@0.4.1
3535
ecmascript-runtime-client@0.4.3
3636
ecmascript-runtime-server@0.4.1
@@ -45,15 +45,15 @@ id-map@1.0.9
4545
livedata@1.0.18
4646
localstorage@1.1.1
4747
logging@1.1.17
48-
meteor@1.7.1
48+
meteor@1.7.2
4949
meteor-base@1.1.0
5050
meteortesting:browser-tests@0.1.1
5151
meteortesting:mocha@0.4.4
5252
minifier-css@1.2.16
53-
minimongo@1.3.1
53+
minimongo@1.3.2
5454
modules@0.10.0
5555
modules-runtime@0.8.0
56-
mongo@1.2.0
56+
mongo@1.2.2
5757
mongo-dev-server@1.0.1
5858
mongo-id@1.0.6
5959
npm-bcrypt@0.9.3
@@ -73,7 +73,7 @@ routepolicy@1.0.12
7373
service-configuration@1.0.11
7474
sha@1.0.9
7575
srp@1.0.10
76-
standard-minifier-css@1.3.4
76+
standard-minifier-css@1.3.5
7777
tmeasday:check-npm-versions@0.3.1
7878
tracker@1.1.3
7979
underscore@1.0.10

both/collections/user.collection.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import { Courses } from './course.collection';
1818

1919

20+
21+
2022
/**
2123
EXTEND USER COLLECTION
2224
**/

both/models/user.model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
export interface Profile {
1010
name: string;
1111
organization: string;
12-
email: string;
1312
picture?: string;
1413
}
1514

@@ -28,8 +27,9 @@
2827

2928
/* USER MODEL */
3029
export interface User extends Meteor.User {
31-
_id? : string,
30+
_id? : string;
31+
username: string;
3232
profile: Profile;
33-
global_admin: boolean,
33+
global_admin: boolean;
3434
roles: Privilege[];
3535
}

both/schemas/user.schema.ts

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import { Role } from '../models/user.model';
1515
organization: {
1616
type: String
1717
},
18-
email: {
19-
type: String
20-
},
2118
picture: {
2219
type: String
2320
}
@@ -38,19 +35,49 @@ import { Role } from '../models/user.model';
3835

3936
/* User Schema */
4037
export const UserSchema : SimpleSchema = new SimpleSchema({
38+
_id: {
39+
type: String,
40+
regEx: SimpleSchema.RegEx.Id
41+
},
42+
username: {
43+
type: String,
44+
regEx: /^[a-z0-9A-Z_]{3,15}$/
45+
},
46+
emails: {
47+
optional: true,
48+
type: Array
49+
},
50+
"emails.$": {
51+
type: new SimpleSchema({
52+
address: {
53+
type: String,
54+
regEx: SimpleSchema.RegEx.Email
55+
},
56+
verified: {
57+
optional: true,
58+
type: Boolean
59+
}
60+
})
61+
},
62+
createdAt: {
63+
type: Date
64+
},
65+
profile: {
66+
type: profileSchema,
67+
optional: true
68+
},
4169
services: {
4270
type: Object,
4371
optional: true,
4472
blackbox: true
4573
},
46-
profile: {
47-
type: profileSchema
48-
},
4974
global_admin: {
50-
type: Boolean
75+
type: Boolean,
76+
optional: true
5177
},
5278
roles: {
53-
type: Array
79+
type: Array,
80+
optional: true
5481
},
5582
'roles.$': {
5683
type: privilegeSchema

client/imports/app.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Router, ActivatedRoute } from '@angular/router';
66
// Meteor
77
import { Meteor } from "meteor/meteor";
88
import { Tracker } from "meteor/tracker";
9+
import { Accounts } from "meteor/accounts-base";
910

1011
// User Model
1112
import { User } from '../../both/models/user.model';

imports/test/fixtures/index.ts

Lines changed: 52 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,6 @@
2525
import { Users } from '../../../both/collections/user.collection';
2626
import { addRoleForCourse } from '../../../server/methods/user.methods';
2727

28-
/*
29-
* cleanupDatabase
30-
* cleans up databases
31-
*/
32-
export function cleanupDatabase(){
33-
CourseRecords.remove({});
34-
Courses.remove({});
35-
Labs.remove({});
36-
Sessions.remove({});
37-
Users.remove({});
38-
}
39-
4028
/*
4129
* defaultFixtures
4230
*/
@@ -59,64 +47,60 @@
5947

6048
constructor(){
6149

50+
// Reset Database
51+
CourseRecords.remove({});
52+
Courses.remove({});
53+
Labs.remove({});
54+
Sessions.remove({});
55+
Users.remove({});
56+
6257
// Users
6358
this.users = {
64-
"global_admin": Users.insert({
65-
username: "global_admin",
66-
profile: {
67-
name : "Derek Brown",
68-
organization : "Carnegie Mellon University",
69-
email : "derek@example.org",
70-
picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg"
71-
},
72-
global_admin: true,
73-
roles: []
74-
}, () => {
75-
Accounts.setPassword(this.users["global_admin"], "global_admin");
76-
}),
77-
78-
"course_admin": Users.insert({
79-
username: "course_admin",
80-
profile: {
81-
name : "Aaron Mortenson",
82-
organization : "Carnegie Mellon University",
83-
email : "aaron@example.org",
84-
picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg"
85-
},
86-
global_admin: false,
87-
roles: []
88-
}, () => {
89-
Accounts.setPassword(this.users["course_admin"], "course_admin");
90-
}),
91-
92-
"instructor": Users.insert({
93-
username: "instructor",
94-
profile: {
95-
name : "Sander Shi",
96-
organization : "Carnegie Mellon University",
97-
email : "sander@example.org",
98-
picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg"
99-
},
100-
global_admin: false,
101-
roles: []
102-
}, () => {
103-
Accounts.setPassword(this.users["instructor"], "instructor");
104-
}),
105-
106-
"student": Users.insert({
107-
username: "student",
108-
profile: {
109-
name : "Cem Ersoz",
110-
organization : "Carnegie Mellon University",
111-
email : "cem@example.org",
112-
picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg"
113-
},
114-
global_admin: false,
115-
roles: []
116-
}, () => {
117-
Accounts.setPassword(this.users["student"], "student");
118-
})
119-
};
59+
global_admin : <string> Accounts.createUser({
60+
username: "global_admin",
61+
email: "global-admin@andrew.cmu.edu",
62+
password: "global_admin",
63+
profile: {
64+
name : "Global Admin",
65+
organization : "Carnegie Mellon University",
66+
picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg"
67+
}
68+
}),
69+
70+
course_admin : <string> Accounts.createUser({
71+
username: "course_admin",
72+
email: "course-admin@andrew.cmu.edu",
73+
password: "course_admin",
74+
profile: {
75+
name : "Course Admin",
76+
organization : "Carnegie Mellon University",
77+
picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg"
78+
}
79+
}),
80+
81+
instructor : <string> Accounts.createUser({
82+
username: "instructor",
83+
email: "instructor@andrew.cmu.edu",
84+
password: "instructor",
85+
profile: {
86+
name : "Instructor",
87+
organization : "Carnegie Mellon University",
88+
picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg"
89+
}
90+
}),
91+
92+
student : <string> Accounts.createUser({
93+
username: "student",
94+
email: "student@andrew.cmu.edu",
95+
password: "student",
96+
profile: {
97+
name : "Student",
98+
organization : "Carnegie Mellon University",
99+
picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg"
100+
}
101+
})
102+
}
103+
Users.setGlobalAdministrator(this.users.global_admin, true);
120104

121105
// Courses
122106
this.courses = ({
@@ -187,22 +171,4 @@
187171
addRoleForCourse(this.courses.gpi, this.users.instructor, Role.instructor);
188172

189173
}
190-
191-
public destructor(){
192-
193-
// Delete Users
194-
_.forEach(this.users, function(value, key){
195-
Users.remove({ '_id' : value });
196-
})
197-
198-
// Delete Courses
199-
_.forEach(this.courses, function(value, key){
200-
Courses.remove({ '_id' : value });
201-
})
202-
203-
// Delete Labs
204-
_.forEach(this.labs, function(value, key){
205-
Labs.remove({ '_id' : value });
206-
})
207-
}
208174
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@types/dockerode": "^2.4.6",
1616
"@types/file-saver": "0.0.1",
1717
"@types/lodash": "^4.14.68",
18-
"@types/meteor": "^1.4.2",
18+
"@types/meteor": "1.4.2",
1919
"@types/node": "^8.0.15",
2020
"@types/node-cache": "^4.1.0",
2121
"@types/node-fibers": "0.0.28",
@@ -54,7 +54,7 @@
5454
"file-saver": "^1.3.3",
5555
"lodash": "^4.17.4",
5656
"meteor-node-stubs": "^0.2.11",
57-
"meteor-rxjs": "^0.4.7",
57+
"meteor-rxjs": "0.4.7",
5858
"node-cache": "^4.1.1",
5959
"node-etcd": "^5.1.0",
6060
"prismjs": "^1.6.0",

server/imports/runtime/lab_runtime.app-test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { expect } from 'chai';
88
import * as _ from 'lodash';
99

10-
import { DefaultFixtures, cleanupDatabase } from '../../../imports/test/fixtures';
10+
import { DefaultFixtures } from '../../../imports/test/fixtures';
1111
import { Example1 } from '../../../imports/test/fixtures/example_labs';
1212

1313
import { Lab, LabFileImportOpts } from '../../../both/models/lab.model';
@@ -24,14 +24,9 @@ export function runTest(){
2424
let lab_id_mongo : string;
2525

2626
before(function(){
27-
cleanupDatabase();
2827
fixtures = new DefaultFixtures();
2928
});
3029

31-
after(function(){
32-
fixtures.destructor();
33-
});
34-
3530
it('should import from file', function(){
3631
let record : LabFileImportOpts = {
3732
course_id: fixtures.courses.gpi,

0 commit comments

Comments
 (0)