Merge pull request #2071 from delenius/prototype-tests

Modify JS PetStore tests for prototypes change
This commit is contained in:
wing328 2016-02-09 10:41:30 +08:00
commit cabe003e02
5 changed files with 440 additions and 445 deletions

View File

@ -20,65 +20,64 @@
var Category = function Category() { var Category = function Category() {
var self = this;
/** /**
* datatype: Integer * datatype: Integer
**/ **/
self['id'] = null; this['id'] = null;
/** /**
* datatype: String * datatype: String
**/ **/
self['name'] = null; this['name'] = null;
};
self.constructFromObject = function(data) { Category.prototype.constructFromObject = function(data) {
if (!data) { if (!data) {
return this;
}
self['id'] = ApiClient.convertToType(data['id'], 'Integer');
self['name'] = ApiClient.convertToType(data['name'], 'String');
return this; return this;
} }
/** this['id'] = ApiClient.convertToType(data['id'], 'Integer');
* @return {Integer}
**/
self.getId = function() {
return self['id'];
}
/**
* @param {Integer} id
**/
self.setId = function(id) {
self['id'] = id;
}
/** this['name'] = ApiClient.convertToType(data['name'], 'String');
* @return {String}
**/
self.getName = function() {
return self['name'];
}
/**
* @param {String} name
**/
self.setName = function(name) {
self['name'] = name;
}
return this;
}
self.toJson = function() {
return JSON.stringify(self); /**
} * @return {Integer}
}; **/
Category.prototype.getId = function() {
return this['id'];
}
/**
* @param {Integer} id
**/
Category.prototype.setId = function(id) {
this['id'] = id;
}
/**
* @return {String}
**/
Category.prototype.getName = function() {
return this['name'];
}
/**
* @param {String} name
**/
Category.prototype.setName = function(name) {
this['name'] = name;
}
Category.prototype.toJson = function() {
return JSON.stringify(this);
}
if (module) { if (module) {
module.Category = Category; module.Category = Category;

View File

@ -48,152 +48,151 @@ var StatusEnum = function StatusEnum() {
var Order = function Order() { var Order = function Order() {
var self = this;
/** /**
* datatype: Integer * datatype: Integer
**/ **/
self['id'] = null; this['id'] = null;
/** /**
* datatype: Integer * datatype: Integer
**/ **/
self['petId'] = null; this['petId'] = null;
/** /**
* datatype: Integer * datatype: Integer
**/ **/
self['quantity'] = null; this['quantity'] = null;
/** /**
* datatype: Date * datatype: Date
**/ **/
self['shipDate'] = null; this['shipDate'] = null;
/** /**
* Order Status * Order Status
* datatype: StatusEnum * datatype: StatusEnum
**/ **/
self['status'] = null; this['status'] = null;
/** /**
* datatype: Boolean * datatype: Boolean
**/ **/
self['complete'] = null; this['complete'] = null;
};
self.constructFromObject = function(data) { Order.prototype.constructFromObject = function(data) {
if (!data) { if (!data) {
return this;
}
self['id'] = ApiClient.convertToType(data['id'], 'Integer');
self['petId'] = ApiClient.convertToType(data['petId'], 'Integer');
self['quantity'] = ApiClient.convertToType(data['quantity'], 'Integer');
self['shipDate'] = ApiClient.convertToType(data['shipDate'], 'Date');
self['status'] = ApiClient.convertToType(data['status'], 'String');
self['complete'] = ApiClient.convertToType(data['complete'], 'Boolean');
return this; return this;
} }
/** this['id'] = ApiClient.convertToType(data['id'], 'Integer');
* @return {Integer}
**/
self.getId = function() {
return self['id'];
}
/**
* @param {Integer} id
**/
self.setId = function(id) {
self['id'] = id;
}
/** this['petId'] = ApiClient.convertToType(data['petId'], 'Integer');
* @return {Integer}
**/
self.getPetId = function() {
return self['petId'];
}
/**
* @param {Integer} petId
**/
self.setPetId = function(petId) {
self['petId'] = petId;
}
/** this['quantity'] = ApiClient.convertToType(data['quantity'], 'Integer');
* @return {Integer}
**/
self.getQuantity = function() {
return self['quantity'];
}
/**
* @param {Integer} quantity
**/
self.setQuantity = function(quantity) {
self['quantity'] = quantity;
}
/** this['shipDate'] = ApiClient.convertToType(data['shipDate'], 'Date');
* @return {Date}
**/
self.getShipDate = function() {
return self['shipDate'];
}
/**
* @param {Date} shipDate
**/
self.setShipDate = function(shipDate) {
self['shipDate'] = shipDate;
}
/** this['status'] = ApiClient.convertToType(data['status'], 'String');
* get Order Status
* @return {StatusEnum}
**/
self.getStatus = function() {
return self['status'];
}
/**
* set Order Status
* @param {StatusEnum} status
**/
self.setStatus = function(status) {
self['status'] = status;
}
/** this['complete'] = ApiClient.convertToType(data['complete'], 'Boolean');
* @return {Boolean}
**/
self.getComplete = function() {
return self['complete'];
}
/**
* @param {Boolean} complete
**/
self.setComplete = function(complete) {
self['complete'] = complete;
}
return this;
}
self.toJson = function() {
return JSON.stringify(self); /**
} * @return {Integer}
}; **/
Order.prototype.getId = function() {
return this['id'];
}
/**
* @param {Integer} id
**/
Order.prototype.setId = function(id) {
this['id'] = id;
}
/**
* @return {Integer}
**/
Order.prototype.getPetId = function() {
return this['petId'];
}
/**
* @param {Integer} petId
**/
Order.prototype.setPetId = function(petId) {
this['petId'] = petId;
}
/**
* @return {Integer}
**/
Order.prototype.getQuantity = function() {
return this['quantity'];
}
/**
* @param {Integer} quantity
**/
Order.prototype.setQuantity = function(quantity) {
this['quantity'] = quantity;
}
/**
* @return {Date}
**/
Order.prototype.getShipDate = function() {
return this['shipDate'];
}
/**
* @param {Date} shipDate
**/
Order.prototype.setShipDate = function(shipDate) {
this['shipDate'] = shipDate;
}
/**
* get Order Status
* @return {StatusEnum}
**/
Order.prototype.getStatus = function() {
return this['status'];
}
/**
* set Order Status
* @param {StatusEnum} status
**/
Order.prototype.setStatus = function(status) {
this['status'] = status;
}
/**
* @return {Boolean}
**/
Order.prototype.getComplete = function() {
return this['complete'];
}
/**
* @param {Boolean} complete
**/
Order.prototype.setComplete = function(complete) {
this['complete'] = complete;
}
Order.prototype.toJson = function() {
return JSON.stringify(this);
}
if (module) { if (module) {
module.Order = Order; module.Order = Order;

View File

@ -48,154 +48,153 @@ var StatusEnum = function StatusEnum() {
var Pet = function Pet(photoUrls, name) { var Pet = function Pet(photoUrls, name) {
var self = this;
/** /**
* datatype: Integer * datatype: Integer
**/ **/
self['id'] = null; this['id'] = null;
/** /**
* datatype: Category * datatype: Category
**/ **/
self['category'] = new Category(); this['category'] = new Category();
/** /**
* datatype: String * datatype: String
* required * required
**/ **/
self['name'] = name; this['name'] = name;
/** /**
* datatype: [String] * datatype: [String]
* required * required
**/ **/
self['photoUrls'] = photoUrls; this['photoUrls'] = photoUrls;
/** /**
* datatype: [Tag] * datatype: [Tag]
**/ **/
self['tags'] = []; this['tags'] = [];
/** /**
* pet status in the store * pet status in the store
* datatype: StatusEnum * datatype: StatusEnum
**/ **/
self['status'] = null; this['status'] = null;
};
self.constructFromObject = function(data) { Pet.prototype.constructFromObject = function(data) {
if (!data) { if (!data) {
return this;
}
self['id'] = ApiClient.convertToType(data['id'], 'Integer');
self['category'].constructFromObject(data['category']);
self['name'] = ApiClient.convertToType(data['name'], 'String');
self['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']);
self['tags'] = ApiClient.convertToType(data['tags'], [Tag]);
self['status'] = ApiClient.convertToType(data['status'], 'String');
return this; return this;
} }
/** this['id'] = ApiClient.convertToType(data['id'], 'Integer');
* @return {Integer}
**/
self.getId = function() {
return self['id'];
}
/**
* @param {Integer} id
**/
self.setId = function(id) {
self['id'] = id;
}
/** this['category'].constructFromObject(data['category']);
* @return {Category}
**/
self.getCategory = function() {
return self['category'];
}
/**
* @param {Category} category
**/
self.setCategory = function(category) {
self['category'] = category;
}
/** this['name'] = ApiClient.convertToType(data['name'], 'String');
* @return {String}
**/
self.getName = function() {
return self['name'];
}
/**
* @param {String} name
**/
self.setName = function(name) {
self['name'] = name;
}
/** this['photoUrls'] = ApiClient.convertToType(data['photoUrls'], ['String']);
* @return {[String]}
**/
self.getPhotoUrls = function() {
return self['photoUrls'];
}
/**
* @param {[String]} photoUrls
**/
self.setPhotoUrls = function(photoUrls) {
self['photoUrls'] = photoUrls;
}
/** this['tags'] = ApiClient.convertToType(data['tags'], [Tag]);
* @return {[Tag]}
**/
self.getTags = function() {
return self['tags'];
}
/**
* @param {[Tag]} tags
**/
self.setTags = function(tags) {
self['tags'] = tags;
}
/** this['status'] = ApiClient.convertToType(data['status'], 'String');
* get pet status in the store
* @return {StatusEnum}
**/
self.getStatus = function() {
return self['status'];
}
/**
* set pet status in the store
* @param {StatusEnum} status
**/
self.setStatus = function(status) {
self['status'] = status;
}
return this;
}
self.toJson = function() {
return JSON.stringify(self); /**
} * @return {Integer}
}; **/
Pet.prototype.getId = function() {
return this['id'];
}
/**
* @param {Integer} id
**/
Pet.prototype.setId = function(id) {
this['id'] = id;
}
/**
* @return {Category}
**/
Pet.prototype.getCategory = function() {
return this['category'];
}
/**
* @param {Category} category
**/
Pet.prototype.setCategory = function(category) {
this['category'] = category;
}
/**
* @return {String}
**/
Pet.prototype.getName = function() {
return this['name'];
}
/**
* @param {String} name
**/
Pet.prototype.setName = function(name) {
this['name'] = name;
}
/**
* @return {[String]}
**/
Pet.prototype.getPhotoUrls = function() {
return this['photoUrls'];
}
/**
* @param {[String]} photoUrls
**/
Pet.prototype.setPhotoUrls = function(photoUrls) {
this['photoUrls'] = photoUrls;
}
/**
* @return {[Tag]}
**/
Pet.prototype.getTags = function() {
return this['tags'];
}
/**
* @param {[Tag]} tags
**/
Pet.prototype.setTags = function(tags) {
this['tags'] = tags;
}
/**
* get pet status in the store
* @return {StatusEnum}
**/
Pet.prototype.getStatus = function() {
return this['status'];
}
/**
* set pet status in the store
* @param {StatusEnum} status
**/
Pet.prototype.setStatus = function(status) {
this['status'] = status;
}
Pet.prototype.toJson = function() {
return JSON.stringify(this);
}
if (module) { if (module) {
module.Pet = Pet; module.Pet = Pet;

View File

@ -20,65 +20,64 @@
var Tag = function Tag() { var Tag = function Tag() {
var self = this;
/** /**
* datatype: Integer * datatype: Integer
**/ **/
self['id'] = null; this['id'] = null;
/** /**
* datatype: String * datatype: String
**/ **/
self['name'] = null; this['name'] = null;
};
self.constructFromObject = function(data) { Tag.prototype.constructFromObject = function(data) {
if (!data) { if (!data) {
return this;
}
self['id'] = ApiClient.convertToType(data['id'], 'Integer');
self['name'] = ApiClient.convertToType(data['name'], 'String');
return this; return this;
} }
/** this['id'] = ApiClient.convertToType(data['id'], 'Integer');
* @return {Integer}
**/
self.getId = function() {
return self['id'];
}
/**
* @param {Integer} id
**/
self.setId = function(id) {
self['id'] = id;
}
/** this['name'] = ApiClient.convertToType(data['name'], 'String');
* @return {String}
**/
self.getName = function() {
return self['name'];
}
/**
* @param {String} name
**/
self.setName = function(name) {
self['name'] = name;
}
return this;
}
self.toJson = function() {
return JSON.stringify(self); /**
} * @return {Integer}
}; **/
Tag.prototype.getId = function() {
return this['id'];
}
/**
* @param {Integer} id
**/
Tag.prototype.setId = function(id) {
this['id'] = id;
}
/**
* @return {String}
**/
Tag.prototype.getName = function() {
return this['name'];
}
/**
* @param {String} name
**/
Tag.prototype.setName = function(name) {
this['name'] = name;
}
Tag.prototype.toJson = function() {
return JSON.stringify(this);
}
if (module) { if (module) {
module.Tag = Tag; module.Tag = Tag;

View File

@ -20,194 +20,193 @@
var User = function User() { var User = function User() {
var self = this;
/** /**
* datatype: Integer * datatype: Integer
**/ **/
self['id'] = null; this['id'] = null;
/** /**
* datatype: String * datatype: String
**/ **/
self['username'] = null; this['username'] = null;
/** /**
* datatype: String * datatype: String
**/ **/
self['firstName'] = null; this['firstName'] = null;
/** /**
* datatype: String * datatype: String
**/ **/
self['lastName'] = null; this['lastName'] = null;
/** /**
* datatype: String * datatype: String
**/ **/
self['email'] = null; this['email'] = null;
/** /**
* datatype: String * datatype: String
**/ **/
self['password'] = null; this['password'] = null;
/** /**
* datatype: String * datatype: String
**/ **/
self['phone'] = null; this['phone'] = null;
/** /**
* User Status * User Status
* datatype: Integer * datatype: Integer
**/ **/
self['userStatus'] = null; this['userStatus'] = null;
};
self.constructFromObject = function(data) { User.prototype.constructFromObject = function(data) {
if (!data) { if (!data) {
return this;
}
self['id'] = ApiClient.convertToType(data['id'], 'Integer');
self['username'] = ApiClient.convertToType(data['username'], 'String');
self['firstName'] = ApiClient.convertToType(data['firstName'], 'String');
self['lastName'] = ApiClient.convertToType(data['lastName'], 'String');
self['email'] = ApiClient.convertToType(data['email'], 'String');
self['password'] = ApiClient.convertToType(data['password'], 'String');
self['phone'] = ApiClient.convertToType(data['phone'], 'String');
self['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Integer');
return this; return this;
} }
/** this['id'] = ApiClient.convertToType(data['id'], 'Integer');
* @return {Integer}
**/
self.getId = function() {
return self['id'];
}
/**
* @param {Integer} id
**/
self.setId = function(id) {
self['id'] = id;
}
/** this['username'] = ApiClient.convertToType(data['username'], 'String');
* @return {String}
**/
self.getUsername = function() {
return self['username'];
}
/**
* @param {String} username
**/
self.setUsername = function(username) {
self['username'] = username;
}
/** this['firstName'] = ApiClient.convertToType(data['firstName'], 'String');
* @return {String}
**/
self.getFirstName = function() {
return self['firstName'];
}
/**
* @param {String} firstName
**/
self.setFirstName = function(firstName) {
self['firstName'] = firstName;
}
/** this['lastName'] = ApiClient.convertToType(data['lastName'], 'String');
* @return {String}
**/
self.getLastName = function() {
return self['lastName'];
}
/**
* @param {String} lastName
**/
self.setLastName = function(lastName) {
self['lastName'] = lastName;
}
/** this['email'] = ApiClient.convertToType(data['email'], 'String');
* @return {String}
**/
self.getEmail = function() {
return self['email'];
}
/**
* @param {String} email
**/
self.setEmail = function(email) {
self['email'] = email;
}
/** this['password'] = ApiClient.convertToType(data['password'], 'String');
* @return {String}
**/
self.getPassword = function() {
return self['password'];
}
/**
* @param {String} password
**/
self.setPassword = function(password) {
self['password'] = password;
}
/** this['phone'] = ApiClient.convertToType(data['phone'], 'String');
* @return {String}
**/
self.getPhone = function() {
return self['phone'];
}
/**
* @param {String} phone
**/
self.setPhone = function(phone) {
self['phone'] = phone;
}
/** this['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Integer');
* get User Status
* @return {Integer}
**/
self.getUserStatus = function() {
return self['userStatus'];
}
/**
* set User Status
* @param {Integer} userStatus
**/
self.setUserStatus = function(userStatus) {
self['userStatus'] = userStatus;
}
return this;
}
self.toJson = function() {
return JSON.stringify(self); /**
} * @return {Integer}
}; **/
User.prototype.getId = function() {
return this['id'];
}
/**
* @param {Integer} id
**/
User.prototype.setId = function(id) {
this['id'] = id;
}
/**
* @return {String}
**/
User.prototype.getUsername = function() {
return this['username'];
}
/**
* @param {String} username
**/
User.prototype.setUsername = function(username) {
this['username'] = username;
}
/**
* @return {String}
**/
User.prototype.getFirstName = function() {
return this['firstName'];
}
/**
* @param {String} firstName
**/
User.prototype.setFirstName = function(firstName) {
this['firstName'] = firstName;
}
/**
* @return {String}
**/
User.prototype.getLastName = function() {
return this['lastName'];
}
/**
* @param {String} lastName
**/
User.prototype.setLastName = function(lastName) {
this['lastName'] = lastName;
}
/**
* @return {String}
**/
User.prototype.getEmail = function() {
return this['email'];
}
/**
* @param {String} email
**/
User.prototype.setEmail = function(email) {
this['email'] = email;
}
/**
* @return {String}
**/
User.prototype.getPassword = function() {
return this['password'];
}
/**
* @param {String} password
**/
User.prototype.setPassword = function(password) {
this['password'] = password;
}
/**
* @return {String}
**/
User.prototype.getPhone = function() {
return this['phone'];
}
/**
* @param {String} phone
**/
User.prototype.setPhone = function(phone) {
this['phone'] = phone;
}
/**
* get User Status
* @return {Integer}
**/
User.prototype.getUserStatus = function() {
return this['userStatus'];
}
/**
* set User Status
* @param {Integer} userStatus
**/
User.prototype.setUserStatus = function(userStatus) {
this['userStatus'] = userStatus;
}
User.prototype.toJson = function() {
return JSON.stringify(this);
}
if (module) { if (module) {
module.User = User; module.User = User;